perm filename CMBASE.MF[MF,DEK]1 blob
sn#433202 filedate 1979-04-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 % Basic subroutines for Computer Modern Fonts
C00006 00003 subroutine ucleftserif(index i):
C00007 ENDMK
C⊗;
% Basic subroutines for Computer Modern Fonts
eps=.000314159; % small positive number
subroutine fontbegin:
no eqtrace; no calltrace;
new cf,typesize,h,c,e,d,a,b,w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11;
typesize=rh+rd+2rb; cf.typesize=pixels.typesize-1;
h=round cf.rh; c=round cf.rc; e=round cf.re;
d=round cf.rd; a=round cf.ra; b=round cf.rb;
w0=.5+round(pixels.rw+blacker);
w1=.5+round(pixels.rwi+blacker);
w2=.5+round(pixels.rwii+blacker);
w3=.5+round(pixels.rwiii+blacker);
w4=.5+round(pixels.rwiv+blacker);
w5=.5+round(pixels.rwv+blacker);
w6=.5+round(pixels.rwvi+blacker);
w7=.5+round(pixels.rwvii+blacker);
w8=.5+round(pixels.rwviii+blacker);
w9=.5+round(pixels.rwix+blacker);
w10=.5+round(pixels.rwx+blacker);
w11=.5+round(pixels.rwxi+blacker);
trxy slant.
subroutine charbegin(var charno, var charuw, var lftcorr, var rtcorr,
var charh, var chard, var chari):
no eqtrace; no calltrace; no proofmode;
new uw,r,u,italcorr;
r=charuw.u;
uw = charuw-(lftcorr+rtcorr); % width of character in units
italcorr = chari+mi.ru/2; % add half unit to italic correction if mathitalic
charht charh; chardp chard;
if italcorr≥0: charic italcorr; else: charic 0; fi;
if fixwidth≠0: u.uw = 9ru.pixels-1; charwd 9ru; % leave one pixel of extra space
else: u.uw = uw.ru.pixels-1; charwd uw.ru; fi;
incx round(-lftcorr.ru.pixels);
if grid≠0: call"z" box(round lftcorr.ru.pixels); fi.
subroutine box(var offset): % draws grid lines and box around a character
no drawtrace;
new topp,bottom,left,right,pos;
topp=h+b; bottom=-d-b; left=offset; right=offset+u.uw;
x1=x3=x5=x7=x9=x11=x13=x15=x16=left;
x2=x4=x6=x8=x10=x12=x14=x17=x18=right;
y1=y2=0; cpen; 1 draw 1..2; % baseline
y3=y4=e; draw 3..4; % e-line
y5=y6=c; draw 5..6; % x-height
y7=y8=h; draw 7..8; % h-height
y9=y10=topp; draw 9..10; % top of character
y11=y12=-d; draw 11..12; % descender depth
y13=y14=bottom; draw 13..14; % bottom of character
trxy 0; y15=y17=topp; y16=y18=bottom; draw 15..16; % left edge of character
draw 17..18; % right edge of character
trxy slant;
pos=0; call vertloop;
if italcorr>0: trxy 0;
x19=x20=right+italcorr.pixels; y19=topp; y20=0; draw 19..20; % show italic corr
trxy slant; fi.
subroutine vertloop: % recursive subroutine to draw vertical lines at unit intervals
x1=x2=pos; y1=topp; y2=bottom; cpen; if pos≥left: 1 draw 1..2; fi;
new pos; pos=x1+u; if pos≤right: call vertloop; fi.
subroutine ucleftserif(index i):
hpen; lft0x1=lft8xi-ucs.u-.2s.nrand-eps; y1=yi+s.nrand;
w0 draw 1..i.
subroutine darc(index i, index j, var maxwidth):
x1=x5=xi; x2=x4=1/sqrttwo[xi,xj]; x3=xj;
y1=yi; y5=yj; y3=1/2[yi,yj]; y2=1/sqrttwo[y3,yi]; y4=1/sqrttwo[y3,yj];
hpen; draw |w0| 1 {x3-x1,0}..|2/3[w0,maxwidth]| 2 {x3-x1,y3-y1} ..
|maxwidth#| 3 {0,y3-y1} .. |2/3[w0,maxwidth]| 4 {x5-x3,y5-y3} ..
|w0| 5 {x5-x3,0}.